package com.yvchen.yc_system.module;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import org.apache.commons.lang3.StringUtils;

import javax.crypto.Mac;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class Demo {
    public static void main(String[] args) {
        String str = "工单名称:{{thing15.DATA}}\n" +
                "发起人:{{thing23.DATA}}\n" +
                "工单受理人:{{thing42.DATA}}\n" +
                "时间:{{time5.DATA}}\n";
        List<String> cd = getCd(str);
        for (String s : cd) {
            System.out.println("截取的值==>"+s);
        }

        List<String> a = new ArrayList<>();
        a.add("1");
        a.add("2");
        a.add("3");
        a.add("4");
        List<Long> collect = a.stream().map(Long::parseLong).collect(Collectors.toList());
        Long c = 1L;
        System.out.println(collect.contains(c));
    }

    public static List<String> getCd(String s) {
        List<String> strs = new ArrayList<>();
        String p2 = "\\{\\{(.*?)\\}\\}";
        Pattern pattern = Pattern.compile(p2);
        Matcher matcher = pattern.matcher(s);
        while (matcher.find()) {
            String replace = matcher.group().replace("{{", "").replace("}}", "");
            strs.add(replace.substring(0, replace.indexOf(".")));
        }
        return strs;
    }
}
